import Vue from 'vue'
import VueRouter from 'vue-router'
// import home from '../views/home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/home',
    name: 'home',
    component: () => import('../views/home.vue')
  },
  {
    path: '/sult',
    name: 'sult',
    component: () => import('../views/sult.vue')
  },
  {
    path: '/share/:id',
    name: 'share',
    component: () => import('../views/share.vue')
  },
  {
    path: '/',
    redirect: '/home'
  },
]

const router = new VueRouter({
  routes
})

// 跳转后返回顶部
router.afterEach((to,from,next) => {
  window.scrollTo(0,0);
})

export default router

